package base.render;

import static org.lwjgl.opengl.GL11.glTranslatef;

import java.awt.Rectangle;

import org.lwjgl.opengl.GL11;

import base.common.ILiving;
import base.living.Entity;

public class RenderEntityMissing extends Render
{
	@Override
	public void onRender(ILiving par1ILiving)
	{
		if (par1ILiving instanceof Entity)
		{
			Entity entity = (Entity) par1ILiving;
			GL11.glPushMatrix();
			{
				Rectangle boundingbox = entity.getBoundingBox();

				glTranslatef(boundingbox.x + boundingbox.width / 2, boundingbox.y + boundingbox.height / 2, 0);
				drawWithRotation(entity.getPosRot());
				glTranslatef(-boundingbox.x - boundingbox.width / 2, -boundingbox.y - boundingbox.height / 2, 0);

				drawWithColor(0xFF00FF);
				drawBox(boundingbox.x, boundingbox.y, boundingbox.width, boundingbox.height);
			}
			GL11.glPopMatrix();
		}
		else
		{
			GL11.glPushMatrix();
			{
				drawWithColor(0xFF00FF);
				drawBox(8, 8, 16, 16);
			}
			GL11.glPopMatrix();
		}
	}
}
